Skip to content

upgrade: pagination package upgrade for Solid 2.0#871

Open
davedbase wants to merge 1 commit into
solidjs-community:nextfrom
davedbase:update/v2/pagination
Open

upgrade: pagination package upgrade for Solid 2.0#871
davedbase wants to merge 1 commit into
solidjs-community:nextfrom
davedbase:update/v2/pagination

Conversation

@davedbase
Copy link
Copy Markdown
Member

@davedbase davedbase commented May 4, 2026

Migrate @solid-primitives/pagination to Solid.js v2.0 beta.10. Replaces createResource (removed) with a manual fetch + cancellation effect, replaces createComputed (removed) with a derived memo for page clamping, moves isServer to @solidjs/web, and removes batch().

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Updated to require Solid.js v2.0-beta.10 with @solidjs/web peer dependency
    • createInfiniteScroll no longer exposes pages.loading and pages.error properties
    • isServer must now be imported from @solidjs/web
    • createInfiniteScroll return type: loader is now a ref function instead of a directive
  • Documentation

    • Updated README with peer dependency requirements and revised API usage examples

Review Change Stack

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: b3a91c6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solid-primitives/pagination Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@davedbase davedbase added this to the Solid 2.0 Migration milestone May 4, 2026
@davedbase davedbase marked this pull request as ready for review May 23, 2026 16:06
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d577353-03c3-496d-9947-fa9e763f69eb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/pagination/src/index.ts`:
- Around line 398-403: The Promise returned by fetcher(currentPage) can reject
and leaves fetching stuck true; wrap the call so rejections are handled (use
.catch(...) or try/catch and a .finally) and always call setFetching(false) even
on error, while preserving the cancelled check and existing behavior for empty
content (use the same symbols: fetcher, currentPage, cancelled, setEnd,
setPages, setFetching); optionally log the error or setEnd(true) on fatal
failures to avoid deadlock and prevent unhandled rejections.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3fed58dc-f439-4b4c-a4ff-813e3104b0b7

📥 Commits

Reviewing files that changed from the base of the PR and between 14d4ea9 and b3a91c6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • .changeset/pagination-solid2-migration.md
  • packages/pagination/README.md
  • packages/pagination/package.json
  • packages/pagination/src/index.ts
  • packages/pagination/test/index.test.ts
  • packages/pagination/test/server.test.ts

Comment on lines +398 to +403
fetcher(currentPage).then(content => {
if (cancelled) return;
if (content.length === 0) setEnd(true);
setPages(p => [...p, ...content]);
setFetching(false);
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Handle rejected fetches so infinite scroll doesn’t deadlock.

If fetcher(currentPage) rejects, setFetching(false) is never reached and fetching() stays true, which blocks further observer-driven loads and can emit unhandled rejections.

Suggested fix
-        fetcher(currentPage).then(content => {
-          if (cancelled) return;
-          if (content.length === 0) setEnd(true);
-          setPages(p => [...p, ...content]);
-          setFetching(false);
-        });
+        fetcher(currentPage)
+          .then(content => {
+            if (cancelled) return;
+            if (content.length === 0) setEnd(true);
+            setPages(p => [...p, ...content]);
+          })
+          .catch(() => {
+            if (cancelled) return;
+            // optionally expose/log error state if desired
+          })
+          .finally(() => {
+            if (!cancelled) setFetching(false);
+          });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fetcher(currentPage).then(content => {
if (cancelled) return;
if (content.length === 0) setEnd(true);
setPages(p => [...p, ...content]);
setFetching(false);
});
fetcher(currentPage)
.then(content => {
if (cancelled) return;
if (content.length === 0) setEnd(true);
setPages(p => [...p, ...content]);
})
.catch(() => {
if (cancelled) return;
// optionally expose/log error state if desired
})
.finally(() => {
if (!cancelled) setFetching(false);
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/pagination/src/index.ts` around lines 398 - 403, The Promise
returned by fetcher(currentPage) can reject and leaves fetching stuck true; wrap
the call so rejections are handled (use .catch(...) or try/catch and a .finally)
and always call setFetching(false) even on error, while preserving the cancelled
check and existing behavior for empty content (use the same symbols: fetcher,
currentPage, cancelled, setEnd, setPages, setFetching); optionally log the error
or setEnd(true) on fatal failures to avoid deadlock and prevent unhandled
rejections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant